package tuan2;

import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class Xulyfile {
	public void Docfile() throws IOException{
		FileReader fr=new FileReader("data.txt");
		BufferedReader br=new BufferedReader(fr);		
		String line="";
		while((line=br.readLine())!=null)
		{
			System.out.println(line);
		}
		br.close();
		fr.close();
	}
	public void Ghifile() throws IOException{
		 FileOutputStream fos=new FileOutputStream("outdata.txt");
		 FileInputStream fis=new FileInputStream("data.txt");
		 PrintWriter pw=new PrintWriter(fos);
		 String text="";		 
		 //pw.println(text);
		 pw.println("chao cac ban: ");
		 pw.println("Da ghi file");
		 pw.close();
		 fos.flush();
		 fos.close();
		 
	}

}
